
package ServicosDAO;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConexaoDAO {

	/*
	 * public Connection getConnection() {
	 * 
	 * String url =
	 * "jdbc:postgresql://ec2-107-21-112-215.compute-1.amazonaws.com:5432/ddu4u82l7f208a"
	 * , usuario = "vfdctwyofxgxzn", senha = "_hu84E9JYv1DNBwU4OHqvMaD8O";
	 * 
	 * try { Class.forName("org.postgresql.Driver"); return
	 * DriverManager.getConnection(url, usuario, senha); } catch (SQLException
	 * e) { e.printStackTrace(); throw new RuntimeException(); } catch
	 * (ClassNotFoundException e) { e.printStackTrace(); throw new
	 * RuntimeException(); } }
	 */

	public Connection getConnection() {

		String url = "jdbc:postgresql://localhost:5432/DISC_ENGENHARIA_1", usuario = "postgres", senha = "david";

		try {
			Class.forName("org.postgresql.Driver");
			return DriverManager.getConnection(url, usuario, senha);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw new RuntimeException();
		}
	}

}